﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PineLake.Drmwe.Encrypts.RSA
{
    /// <summary>
    /// RSA加密/解密 接口
    /// </summary>
    public interface IRSA
    {
        /// <summary>
        /// 生成密钥
        /// </summary>
        /// <param name="PrivateKey">私钥</param>
        /// <param name="PublicKey">公钥</param>
        /// <param name="KeySize">密钥长度：512,1024,2048,4096,8192 推荐用1024 或者2048 加密解密速度安全性比较均衡</param>
        void Generator(out string PrivateKey, out string PublicKey, int KeySize = 2048);
        /// <summary>
        /// RSA加密 将公钥导入到RSA对象中，加密
        /// </summary>
        /// <param name="PublicKey">公钥</param>
        /// <param name="Encryptstring">待加密的字符串(字符最大长度112个字节(56个字符))</param>
        /// <returns></returns>
        string Encrypt(string PublicKey, string Encryptstring);


        /// <summary>
        /// RSA解密 将私钥导入RSA中，解密
        /// </summary>
        /// <param name="PrivateKey">私钥</param>
        /// <param name="Decryptstring">待解密的字符串</param>
        /// <returns></returns>
        string Decrypt(string PrivateKey, string Decryptstring);
    }
}
